﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String appId = (String) session.getAttribute("appid");
	String timeStamp = (String) session.getAttribute("timeStamp");
	String nonceStr = (String) session.getAttribute("nonceStr");
	String packageValue = (String) session.getAttribute("package");
	String paySign = (String) session.getAttribute("sign");
%>

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset="utf-8">

		<link rel="stylesheet" type="text/css" href="files/reset.css"
			media="all">
		<link rel="stylesheet" type="text/css" href="files/m-commerce.css"
			media="all">
		<script type="text/javascript" src="files/jQuery.js"></script>
		
		<link rel="stylesheet"
			href="<%=request.getContextPath()%>/admin/css/pintuer.css">
		<script src="<%=request.getContextPath()%>/admin/js/jquery.js"></script>
		<script src="<%=request.getContextPath()%>/admin/js/pintuer.js"></script>

		<!--禁止分享-->
		<link href="files/jquery.alerts.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" type="text/css" href="files/box.css">
		<script type="text/javascript" src="files/jquery.artDialog.min.js"></script>

		<meta
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
			name="viewport">
		<!-- Mobile Devices Support @begin -->

		<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
		<meta content="no-cache" http-equiv="pragma">
		<meta content="0" http-equiv="expires">
		<meta content="telephone=no, address=no" name="format-detection">
		<meta content="width=device-width, initial-scale=1.0" name="viewport">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<!-- apple devices fullscreen -->
		<meta name="apple-mobile-web-app-status-bar-style"
			content="black-translucent">
		<title>订单支付</title>
		<%
			String msg = (String) request.getAttribute("msg");
		%>
		<%
			String path = request.getContextPath();
		%>
	</head>
	<body>
		
		<div class="wrap pdb60" id="model" data_type="4">
		<input type="hidden" value="${order1.allprice }" id="orderprice">
			<!--订单详情开始-->
			<div class="order">
				<div class="order_content">
					<div class="p_title">
						订单详情
					</div>
					<table class="table table-striped">
						<tr>
							<th>名称</th>
							<th>规格</th>
							<th>单价</th>
							<th>数量</th>
							<th>小计</th>
						</tr>
						<s:if test="order1.paymethod=='积分支付'">
							<s:iterator value="order0s">
								<tr>
									<td><s:property value="product.title"/></td>
									<td><s:property value="guige1value"/>&nbsp;<s:property value="guige2value"/>&nbsp;<s:property value="guige3value"/></td>
									<td><s:property value="product.score"/></td>
									<td><s:property value="num"/></td>
									<td><s:property value="product.score*num"/></td>
								</tr>
							</s:iterator>
						</s:if>
						<s:elseif test="order1.paymethod=='微信支付'">
							<s:iterator value="order0s">
								<tr>
									<td><s:property value="product.title"/></td>
									<td><s:property value="guige1value"/>&nbsp;<s:property value="guige2value"/>&nbsp;<s:property value="guige3value"/></td>
									<td style="color:red;">￥<s:property value="product.price"/></td>
									<td><s:property value="num"/></td>
									<td style="color:red;">￥<s:property value="product.price*num"/></td>
								</tr>
							</s:iterator>
						</s:elseif>
					
					</table>
				</div>

				<!-- <input type="hidden" id="userid" value="26378"> -->
			</div>


			<table class="table" rules="rows" border="1" bordercolor="gray"
				style="background: white;">

				<tr style="background: white; height: 45px;">
					<td style="width: 30%;">
						姓名:
					</td>
					<td style="width: 70%;">
						<s:property value="order1.name"/>
					</td>
				</tr>
				<tr style="background: white; height: 45px;">
					<td>
						地址：
					</td>
					<td>
						<s:property value="order1.province"/>
						<s:property value="order1.city"/>
						<s:property value="order1.qu"/>
						<s:property value="order1.address"/>
					</td>
				</tr>
				<tr style="background: white; height: 45px;">
					<td>
						电话：
					</td>
					<td>
						<s:property value="order1.phone"/>
					</td>
				</tr>
			</table>

			<!--兑换券方式-->
			<div class="order">
				<div class="order_content">
					<s:if test="order1.paymethod=='积分支付'">
					<div class="cash">
						<span id="fancoupons">￥<s:property value="order1.allscore"/></span>总积分
					</div>
					<div class="cash1">
						<span id="orderContentJine">￥<s:property value="order1.postfee"/></span>应付金额
					</div>
					</s:if>
					<s:elseif test="order1.paymethod=='微信支付'">
					<div class="cash">
						<span id="fancoupons">￥<s:property value="order1.allprice"/></span>总价
					</div>
					<div class="cash1">
						<span id="orderContentJine">￥<s:property value="order1.price"/></span>应付金额
					</div>
					
					<div
						style="border-top: 1px solid #dedede; padding-top: 10px; text-align: right; color: #666; font-size: 12px;">
					</div>
					</s:elseif>
				</div>
			</div>

			

			<a href="javascript:void(0)" onclick="callpay()">
				<div class="btn_w">
					<div class="redbtn w100w" id="cartcreateorder">
						立即支付
					</div>
				</div> </a>

			<div class="btn_w">
				<div class="order_tips">
					提交后请在
					<span>1天</span>内完成付款，超时系统将自动取消
				</div>
			</div>


		</div>



		<!--订单详情结束-->

		<s:include value="/w/tmpfoot.jsp"></s:include>
		<!--底部菜单结束-->

		<script type="text/javascript">
   
   function callpay(){
	     var orderprice = $('#orderprice').val();
		 WeixinJSBridge.invoke('getBrandWCPayRequest',{
  		 "appId" : "<%=appId%>","timeStamp" : "<%=timeStamp%>", "nonceStr" : "<%=nonceStr%>", "package" : "<%=packageValue%>","signType" : "MD5", "paySign" : "<%=paySign%>" 
   			},function(res){
				WeixinJSBridge.log(res.err_msg);
 			//	alert(res.err_code + res.err_desc + res.err_msg);
	            if(res.err_msg == "get_brand_wcpay_request:ok"){  
					var score = 0;
		            if(orderprice<=20){
		            	score=20;
			        }else if(orderprice<=100){
			        	score=100;
				    }else if(orderprice<=200){
				    	score=200;
					}else{
						score=500;
					}
			        
	                //alert("微信支付成功!此次消费您获得"+score+"个积分!");  
	                window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb77e811241050c4e&redirect_uri=http%3a%2f%2fwww.tyouz.com%2fbanner!toshouye.com.kecheng.action&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
	            }else if(res.err_msg == "get_brand_wcpay_request:cancel"){  
	                alert("用户取消支付!");  
	            }else{  
	               alert("微信支付失败!");  
	            }  
			})
			

		}

  </script>
	
	</body>
</html>
<div style="display: none">
	<script language="javascript" type="text/javascript"
		src="http://js.users.51.la/17561955.js"></script>
	<noscript>
		<a href="http://www.51.la/?17561955" target="_blank"><img
				alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1;"
				src="http://img.users.51.la/17561955.asp" style="border: none" />
		</a>
	</noscript>
</div>